package com.game.league.entrance.user.bean;

import com.game.base.app.base.BaseData;

import org.json.JSONObject;

/**
 * 微信用户信息解析
 * Created by Su on 2019/5/23.
 */
public class WXUserInfo extends BaseData {
    private String nickname;  // 昵称
    private Integer gender;  // 性别  1 = 男性，2 = 女性，0 = 未知
    private String address; // 用户当前位置
    private String avatar;     //头像

    @Override
    public void parseJson(String jsonStr) {
        JSONObject jsonObject = getJsonObject(jsonStr);
        this.nickname = jsonObject.optString("nickname");
        this.gender = jsonObject.optInt("sex");
        this.address = jsonObject.optString("country") + jsonObject.optString("province")
                + jsonObject.optString("city");
        this.avatar = jsonObject.optString("headimgurl");
    }

    public String getNickname() {
        return nickname;
    }

    public Integer getGender() {
        return gender;
    }

    public String getAddress() {
        return address;
    }

    public String getAvatar() {
        return avatar;
    }
}
